Hello,
// Remove any locks in the database
void ClearAllLocks() {
LockList Llist
Lock lockItem
string errMess
Skip lockSkip = create
int count=0
cout<< "Clearing database locks...\n"
Llist = getLocksInDatabase(true)
for lockItem in Llist do {
put(lockSkip, count++, lockItem)
}
for lockItem in lockSkip do {
string thisUser = lockItem.user
cout << "Attempting to remove lock for " thisUser "\n"
errMess = remove(lockItem)
if(! null errMess) cout<< "Error Removing Lock: " errMess "\n"
else cout << "Succesfully removed lock for " thisUser "\n"
}
delete Llist
delete lockSkip
//the above is not removing the share locks form the database so need to scroll through each module individually -
Module thisMod
for thisMod in database do {
Llist = getLocksInModule(module(fullName(thisMod)), true)
lockSkip = create
for lockItem in Llist do {
put(lockSkip, count++, lockItem)
}
for lockItem in lockSkip do {
string thisUser = lockItem.user
cout << "Attempting to remove Shareable lock for " thisUser " on " fullName(thisMod) "\n"
errMess = remove(lockItem)
if(! null errMess) cout<< "Error Removing Lock for " thisUser " on " fullName(thisMod) "\n" errMess "\n"
else cout << "Succesfully removed lock for " thisUser " on " fullName(thisMod) "\n"
delete Llist
delete lockSkip
}
}
}
Richard_Good - Fri Jan 18 10:05:57 EST 2013 |
Re: clear locks issue
Hi, @echo off "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -user 2> C:\Working_Directory\tmp\DOORS_User_Connect.txt FOR /F "eol=; tokens=3* delims=:, " %%a in (C:\Working_Directory\tmp\DOORS_User_Connect.txt) do ( rem if "%%a" EQU "**********" "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -k %%a "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -k %%a ) :END endlocal
|
Re: clear locks issue Johnny_P - Mon Jan 21 02:57:34 EST 2013
Hi, @echo off "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -user 2> C:\Working_Directory\tmp\DOORS_User_Connect.txt FOR /F "eol=; tokens=3* delims=:, " %%a in (C:\Working_Directory\tmp\DOORS_User_Connect.txt) do ( rem if "%%a" EQU "**********" "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -k %%a "C:\Program Files (x86)\IBM\Rational\DOORS\9.3\bin\dbadmin" -data PORT@SERVER -k %%a ) :END endlocal
|
Re: clear locks issue Richard_Good - Mon Jan 21 12:45:46 EST 2013 Oh thanks for reminding me! The commented out EQU line was for testing purposes only. We didn't have had a test server and with this line I was able to only kick myself or a test user and see if it works. Regards Johnny |
Re: clear locks issue Johnny_P - Tue Jan 22 02:40:56 EST 2013 Needed to combine my script and your script, share locks on projects/ folders sometimes remain if I do not, but my "on server" project and module archive now work reliably. Thanks again for the tip. Richard |